package rpt.yto.flex.remote.data.dao.processor;

public class Query_dirpsn {

	private static Query_dirpsn query = new Query_dirpsn();
	
	private Query_dirpsn() {
		
	}
	
	public static Query_dirpsn getInstance() {
		
		return query;
	}
	
	public String getQuerySQL() {
		
		StringBuilder builder = new StringBuilder();
		
		builder.append(" select rownum rowno , temp.zg_count + temp.gjzg_gjzy_count + temp.jl_gjjl_zj_count + temp.fzj_zj_zszj_count + temp.gjzj_fzc_count total , temp.* from ( ");
		builder.append(" select unitdistinction statistictype ,  ");
		builder.append(" sum(nvl(case when jobname = '主管' then count end , 0)) zg_count , ");
		builder.append(" sum(nvl(case when jobname = '主管/高级专员' then count end , 0)) gjzg_gjzy_count , ");
		builder.append(" sum(nvl(case when jobname = '经理/高级经理/专家' then count end , 0)) jl_gjjl_zj_count , ");
		builder.append(" sum(nvl(case when jobname = '副总监/总监/资深专家' then count end , 0)) fzj_zj_zszj_count ,  ");
		builder.append(" sum(nvl(case when jobname = '高级总监/副总裁' then count end , 0)) gjzj_fzc_count ");
		builder.append(" from vw_yto_compenent ");
		builder.append(" group by unitdistinction ");
		builder.append(" order by unitdistinction) temp where statistictype is not null");
		
		return builder.toString();
		
	}
	
}
